<template>
  <view class="container-white">
    <view class="content">
      <view style="display: flex;flex-wrap: wrap;">
        <view class="options" v-for="(item,index) in scantron" :key="index">
          <view
            class="stide"
            :class="item.answResult == 1?'correct':(item.answResult == 0?'mistake':'')"
            @tap="goTopic(index)"
          >{{index+1}}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { post_md5 } from '../../common/request'
import { formatSeconds } from '../../common/common'
export default {
  data() {
    return {
      scantron: [],
      params: {},
      // num: 0,
      num: [],
      hidden: false,
      duration: 0,
      remainingTime: ''
    }
  },
  onLoad(options) {
    this.getScantron(options)
  },
  methods: {
    // 获取答题卡
    getScantron(options) {
      const params = {
        userId: uni.getStorageSync('userId'),
        craftId: options.id
      }
      post_md5('/user/getUserCraftQuesCard', params).then(res => {
        this.scantron = res.data
      })
    },

    // 查看答题卡对应题目
    goTopic(index) {
      uni.setStorageSync('practiceIndex', index)
      uni.navigateBack(1)
    }
  }
}
</script>

<style>
.content {
  background: #ffffff;
}

.options {
  width: 118upx;
  display: flex;
  justify-content: center;
}

.stide {
  margin: 0;
}

/* .disable{
		color: #999999;
		border: 1px solid #999999;
	} */

.mistake {
  background: #ec6663;
  border: 1px solid #ec6663;
  color: #ffffff;
}

.correct {
  background: #3ed325;
  color: #ffffff;
  border: 1px #3ed325 solid;
}
</style>
